//
//  HTAdConfig.swift
//  MagaCore
//
//  Created by MrMessy on 2023/5/18.
//

import Foundation
import HandyJSON

struct HTAdConfig: HandyJSON {
  var var_inter_screen_ad_secs: Int? = 45// 插屏广告间隔时间
  var var_banner_ad_secs: Int? = 540// 播放页激励视频间隔时间
  var var_mbanner_secs: Int? = 180// 热播放页横屏顶部Banner时间间隔，关闭后180s后自动弹出词
  var var_play_lock_tlimit: Int?// 锁电影时间点（即可以免费看6分钟）
  var var_applovin: HTApplovin?
  var var_k2: [String]?// VIP常规引导页开关
  var var_k3: [String]?// VIP活动引导页开关（前置使用条件k2），活动如圣诞节、情人节等
  var var_i3: [String]?
  var var_tel1: [String]?

  mutating func mapping(mapper: HelpingMapper) {
    mapper <<<
      self.var_inter_screen_ad_secs <-- "inter_screen_ad_secs"

    mapper <<<
      self.var_banner_ad_secs <-- "banner_ad_secs"

    mapper <<<
      self.var_mbanner_secs <-- "mbanner_secs"

    mapper <<<
      self.var_play_lock_tlimit <-- "play_lock_tlimit"

    mapper <<<
      self.var_applovin <-- "applovin"

    mapper <<<
      self.var_k2 <-- "k2"

    mapper <<<
      self.var_k3 <-- "k3"

    mapper <<<
      self.var_i3 <-- "i3"

    mapper <<<
      self.var_tel1 <-- "tel1"
  }

  func ht_regularSubImg() -> String {
    if (self.var_i3 != nil) {
      return self.var_i3![0]
    }

    return ""
  }

  func ht_regularSubTitle() -> String {
    if (self.var_i3 != nil) {
      return self.var_i3![1]
    }

    return ""
  }

  func ht_holidaySubImg() -> String {
    if (self.var_k3 != nil) {
      return self.var_k3![1]
    }

    return ""
  }

  func ht_holidaySubStatus() -> Bool {
    if (self.var_k3 != nil) {
      return self.var_k3![0] == "1"
    }

    return false
  }

  func ht_telVipLink() -> String {
    if (self.var_tel1 != nil) {
      return self.var_tel1![0]
    }

    return ""
  }

  func ht_phoneVipLink() -> String {
    if (self.var_tel1 != nil) {
      return self.var_tel1![1]
    }

    return ""
  }
}
